import request from '@/utils/request'
import { deletefn, deletefn1, get, get1 } from '@/utils/request'

// 新闻公告
export function getNewsAndNoticeInfo(page, limit,status,sortStatus, recall ) {
    return get('/api-user/tbMsgApproveController/selectIssue', {
      page,
      limit,
      status,
      sortStatus,
      recall
    })
}
// 审批中
export function getApprovalInfoByStatus(page, limit, status,sortStatus) {
  return get('/api-user/tbMsgApproveController/selectIssue', {
    page,
    limit,
    status,
    sortStatus
  })
}
// 新闻板块
export function getNewsTemplate(status) {
    return get('/api-user/tbPlate', {
      status
    })
}
// 草稿箱

export function getDraftNum(status, issueStatus) {
    return get('/api-user/tbNewsBulletin', {
        status,
        issueStatus
    })
}
export function getDraftNumByPage(page, limit, status, issueStatus) {
    return get('/api-user/tbNewsBulletin', {
        page,
        limit,
        status,
        issueStatus
    })
}
export function putDraftNumInfo(data) {
    return request({
      url: '/api-user/tbNewsBulletin',
      method: 'put',
      data
    })
  }
  
  export function delDraftInfoByIdList(idList) {
    return deletefn1('/api-user/tbNewsBulletin', {
        list: idList
    })
  }
// 发布

  export function addDraftInfoToApproval(data) {
    return request({
      url: '/api-user/tbMsgApproveController/save',
      method: 'post',
      data
    })
}
// 信息审批
export function getApprovalInfo(page, limit,sortStatus) {
    return get('/api-user/tbMsgApproveController/selectIssue', {
      page,
      limit,
      sortStatus
    })
}
// 新闻详情
export function getApprovalInfoById(id) {
  return get('/api-user/tbMsgApproveController/selectId', {
   id
  })
}

export function putApprovalInfoById(data) {
  return request({
    url: '/api-user/tbMsgApproveController',
    method: 'put',
    data
  })
}

// 信息管理--撤回
export function getApprovalInfoByRecall(page, limit, sortStatus, recall) {
  return get('/api-user/tbMsgApproveController/selectIssue', {
    page,
    limit,
    sortStatus,
    recall
  })
}

export function putApprovalInfoByRecall(list) {
  return get('/api-user/tbMsgApproveController/updateRecall', {
    list
  })
}
